//
//  AddViewController.m
//  云律司
//
//  Created by 韦淋 on 2017/7/11.
//  Copyright © 2017年 test. All rights reserved.
//

#import "AddInfoViewController.h"

@interface AddInfoViewController ()<JHPickerDelegate,UITextFieldDelegate,UITextViewDelegate>
{
    BOOL isHaveDian;
}
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSArray *imageArray;
@property (nonatomic, strong) NSArray *placeHolderArray;
@property (nonatomic, strong) NSArray *starArray;
@property (nonatomic, strong) NSDictionary *log_Type;
@property (nonatomic, strong) NSDictionary *charge_Type;
@property (nonatomic, strong) NSDictionary *pay_Type;
@property (nonatomic, strong) NSMutableArray *dataSource;
@property (nonatomic, assign) NSString *selectStr;
@property (nonatomic, assign) NSInteger seletTag;
@end

@implementation AddInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = false;
    //    self.navigationController.interactivePopGestureRecognizer.delaysTouchesBegan=NO;
    NSLog(@"%ld",self.flag);
    self.dataSource = [NSMutableArray array];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initUI];
}
#pragma mark - Private Method
- (void)initUI{
    //    [self.view insertSubview:self.scrollView atIndex:0];
    if (self.flag == 0) {
        self.barTitleLable.text = @"收费详情";
        [self getUI];
    }
    else if (self.flag == 1){
        self.barTitleLable.text = @"编辑日志";
        [self getUI];
    }
    else if (self.flag == 2){
        self.barTitleLable.text = @"侦查机关编辑";
        [self getUI];
    }
    else if (self.flag == 3){
        self.barTitleLable.text = @"检察机关编辑";
        [self getUI];
    }
    else if (self.flag == 4){
        self.barTitleLable.text = @"编辑法院开庭信息";
        [self getUI];
    }
}
- (void)getUI{
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    if (self.flag == 0) {
        scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT + 10);
    }
    if (self.flag == 1) {
        scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT + 50);
    }
    if (self.flag == 2) {
        scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT + 400);
    }
    if (self.flag == 3) {
        scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT + 150);
    }
    if (self.flag == 4) {
        scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT + 400);
    }
    
    scrollView.delegate = self;
    [self.view insertSubview:scrollView atIndex:0];
    
    UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT * 2)];
    backView.backgroundColor = [UIColor whiteColor];
    [scrollView addSubview:backView];
    
    for (int i = 0; i < self.titleArray.count; i ++) {
        
        
        UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(10, 80 + i * 50, self.view.bounds.size.width - 20, 40)];
        bgView.backgroundColor = [UIColor whiteColor];
        bgView.layer.borderWidth = 1.0f;
        bgView.layer.borderColor = [[UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f] CGColor];
        
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0, 40, 40)];
        view.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];

        UILabel *titleLable = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 90, 40)];
        titleLable.textColor = [UIColor blackColor];
        titleLable.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];
        titleLable.font = [UIFont systemFontOfSize:13];
        titleLable.text = self.titleArray[i];
        
        UILabel *redStar = [[UILabel alloc] initWithFrame:CGRectMake(130, 0, 10, 40)];
        redStar.textColor = [UIColor redColor];
        redStar.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];
        redStar.font = [UIFont systemFontOfSize:13];
        redStar.text = self.starArray[i];
        
        [backView addSubview:bgView];
        
        [bgView addSubview:titleLable];
        [bgView addSubview:redStar];
        
        UITextField *inputInfo = [[UITextField alloc] initWithFrame:CGRectMake(160, 80 + i * 50, 200, 40)];
        inputInfo.clearButtonMode = UITextFieldViewModeWhileEditing;
        inputInfo.textAlignment = NSTextAlignmentLeft;
        inputInfo.font = [UIFont systemFontOfSize:13];
        inputInfo.placeholder = self.placeHolderArray[i];
        inputInfo.delegate = self;
        
        UIButton *button_textFiled = [[UIButton alloc] initWithFrame:CGRectMake(160, 80 + i * 50, 200, 40)];
        [button_textFiled addTarget:self action:@selector(textFieldsDidClick:) forControlEvents:(UIControlEventTouchUpInside)];
        

        if (self.flag == 0) {
            inputInfo.tag = i + 100;
            button_textFiled.tag = i + 100;
            if (i == 0) {
                inputInfo.text = self.caseDetailDic[@"ah_number"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 2) {
                inputInfo.keyboardType = UIKeyboardTypeDecimalPad;
            }
            if (i == 1 || i == 3 || i == 4 ) {
                inputInfo.text = self.selectStr;
                button_textFiled.hidden = NO;
            }
            else{
               button_textFiled.hidden = YES;
            }
            
        }
        if (self.flag == 1) {
            inputInfo.tag = i + 200;
            button_textFiled.tag = i+200;
            if (i == 0) {
              inputInfo.text = self.caseDetailDic[@"ay"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 1) {
                inputInfo.text = self.caseDetailDic[@"ah_number"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 2) {
                inputInfo.text = self.caseDetailDic[@"wtr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 3) {
                inputInfo.text = self.caseDetailDic[@"dsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 4) {
                inputInfo.text = self.caseDetailDic[@"dfdsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 5 || i == 6 || i == 7 ) {
                inputInfo.text = self.selectStr;
                button_textFiled.hidden = NO;
            }
            else{
                button_textFiled.hidden = YES;
            }
        }
        if (self.flag == 2) {
            inputInfo.tag = i + 300;
            button_textFiled.tag = i+300;
            if (i == 0) {
                inputInfo.text = self.caseDetailDic[@"ay"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 1) {
                inputInfo.text = self.caseDetailDic[@"ah_number"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 2) {
                inputInfo.text = self.caseDetailDic[@"wtr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 3) {
                inputInfo.text = self.caseDetailDic[@"dsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 4) {
                inputInfo.text = self.caseDetailDic[@"dfdsr"];
                inputInfo.userInteractionEnabled = NO;
            }

            if (i == 12 || i == 13 || i == 14) {
                inputInfo.frame = CGRectMake(160, 80 + i * 50, 80, 40);
                button_textFiled.frame = CGRectMake(160, 80 + i * 50, 80, 40);
                
                UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(230, 80 + i * 50, 40, 40)];
                lable.text = @"-";
                lable.textAlignment = NSTextAlignmentCenter;
                lable.textColor = [UIColor blackColor];
                
                UITextField *endTime = [[UITextField alloc] initWithFrame:CGRectMake(270, 80 + i * 50, 80, 40)];
                endTime.placeholder = @"截止时间";
                endTime.tag = inputInfo.tag *10;
                endTime.clearButtonMode = UITextFieldViewModeWhileEditing;
                endTime.textAlignment = NSTextAlignmentLeft;
                endTime.font = [UIFont systemFontOfSize:13];
                endTime.delegate = self;
                
                UIButton *button_textFiled1 = [[UIButton alloc] initWithFrame:CGRectMake(270, 80 + i * 50, 80, 40)];
                button_textFiled1.tag = button_textFiled.tag * 10;
                [button_textFiled1 addTarget:self action:@selector(textFieldsDidClick:) forControlEvents:(UIControlEventTouchUpInside)];
                
                [backView addSubview:lable];
                [backView addSubview:endTime];
                [backView addSubview:button_textFiled1];
            }
            if (i == 9) {
                inputInfo.keyboardType = UIKeyboardTypePhonePad;
            }
            if (i == 10 || i == 11 || i == 12 || i == 13 || i == 14) {
                inputInfo.text = self.selectStr;
                button_textFiled.hidden = NO;
            }
            else{
                button_textFiled.hidden = YES;
            }
        }
        if (self.flag == 3) {
            button_textFiled.tag = i+400;
            inputInfo.tag = i + 400;
            if (i == 0) {
                inputInfo.text = self.caseDetailDic[@"ay"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 1) {
                inputInfo.text = self.caseDetailDic[@"ah_number"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 2) {
                inputInfo.text = self.caseDetailDic[@"wtr"];
                inputInfo.userInteractionEnabled = NO;
            }if (i == 3) {
                inputInfo.text = self.caseDetailDic[@"dsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 4) {
                inputInfo.text = self.caseDetailDic[@"dfdsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 8) {
                inputInfo.keyboardType = UIKeyboardTypePhonePad;
            }
            if (i == 9) {
                inputInfo.text = self.selectStr;
                button_textFiled.hidden = NO;
                inputInfo.frame = CGRectMake(160, 80 + i * 50, 80, 40);
                button_textFiled.frame = CGRectMake(160, 80 + i * 50, 80, 40);
                
                UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(230, 80 + i * 50, 40, 40)];
                lable.text = @"-";
                lable.textAlignment = NSTextAlignmentCenter;
                lable.textColor = [UIColor blackColor];
                
                UITextField *endTime = [[UITextField alloc] initWithFrame:CGRectMake(270, 80 + i * 50, 80, 40)];
                endTime.placeholder = @"截止时间";
                endTime.tag = inputInfo.tag *10;
                endTime.clearButtonMode = UITextFieldViewModeWhileEditing;
                endTime.textAlignment = NSTextAlignmentLeft;
                endTime.font = [UIFont systemFontOfSize:13];
                endTime.delegate = self;
                
                UIButton *button_textFiled1 = [[UIButton alloc] initWithFrame:CGRectMake(270, 80 + i * 50, 80, 40)];
                button_textFiled1.tag = button_textFiled.tag * 10;
                [button_textFiled1 addTarget:self action:@selector(textFieldsDidClick:) forControlEvents:(UIControlEventTouchUpInside)];
                
                [backView addSubview:lable];
                [backView addSubview:endTime];
                [backView addSubview:button_textFiled1];
            }
            else{
                button_textFiled.hidden = YES;
            }
        }
        if (self.flag == 4) {
            button_textFiled.tag = i+500;
            inputInfo.tag = i + 500;
            if (i == 0) {
                inputInfo.text = self.caseDetailDic[@"ay"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 1) {
                inputInfo.text = self.caseDetailDic[@"ah_number"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 2) {
                inputInfo.text = self.caseDetailDic[@"wtr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 3) {
                inputInfo.text = self.caseDetailDic[@"dsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 4) {
                inputInfo.text = self.caseDetailDic[@"dfdsr"];
                inputInfo.userInteractionEnabled = NO;
            }
            if (i == 13 || i == 15) {
                inputInfo.keyboardType = UIKeyboardTypePhonePad;
            }
            if (i == 6 || i == 7 || i == 8 || i == 9) {
                inputInfo.text = self.selectStr;
                button_textFiled.hidden = NO;
            }
            else{
                button_textFiled.hidden = YES;
            }
        }
        
        
//        [inputInfo addTarget:self action:@selector(textFieldsDidClick:) forControlEvents:(UIControlEventTouchDown)];
        
        UIImageView *titleImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
        titleImage.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];
        titleImage.image = [UIImage imageNamed:self.imageArray[i]];
        
        if (i == self.titleArray.count - 1) {
            bgView.frame = CGRectMake(10, 80 + i * 50, 130, 40);
            inputInfo.hidden = YES;
            
            UITextView *input = [[UITextView alloc] initWithFrame:CGRectMake(10, 80 + (i + 1) * 50, self.view.bounds.size.width - 20, 120)];
            input.layer.borderWidth = 1.0f;
            input.layer.borderColor = [[UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f] CGColor];
            input.autoresizingMask = UIViewAutoresizingFlexibleHeight;
            input.text = @"请填写备注";
            input.tag = 1000;
            input.textColor = [UIColor lightGrayColor];
            input.delegate = self;
            [backView addSubview:input];
            
            
            UIButton *putInButton = [UIButton buttonWithType:UIButtonTypeCustom];
            putInButton.frame = CGRectMake(20, 80 + (i + 1) * 50 + 130, self.view.bounds.size.width - 40, 40);
            [putInButton setTitle:@"发起申请" forState:UIControlStateNormal];
            putInButton.titleLabel.textColor = [UIColor whiteColor];
            putInButton.layer.cornerRadius = 5;
            putInButton.layer.masksToBounds = YES;
            putInButton.backgroundColor = [UIColor colorWithRed:33.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0f];
            [putInButton addTarget:self action:@selector(action_PutIn) forControlEvents:UIControlEventTouchUpInside];
            [backView addSubview:putInButton];
        }
        [bgView addSubview:titleImage];
        [backView addSubview:inputInfo];
        [backView addSubview:button_textFiled];
        [bgView insertSubview:view belowSubview:titleImage];
    }
    
}
//比较两个日期的大小  日期格式为2016-08-14 08：46：20
- (NSInteger)compareDate:(NSString*)aDate withDate:(NSString*)bDate
{
    NSDateFormatter *dateformater = [[NSDateFormatter alloc] init];
    [dateformater setDateFormat:@"yyyy-MM-dd"];
    NSDate *dta = [[NSDate alloc] init];
    NSDate *dtb = [[NSDate alloc] init];
    
    dta = [dateformater dateFromString:aDate];
    dtb = [dateformater dateFromString:bDate];
    NSComparisonResult result = [dta compare:dtb];
    if (result == NSOrderedAscending)
    {
        //bDate比aDate大
        return 1;
    }else if (result == NSOrderedDescending)
    {
        //bDate比aDate小
        return -1;
        
    }
    else{
        return 0;
    }
}

#pragma mark - Button Target
- (void)action_PutIn{
    if (self.flag == 0) {
        UITextField *textField = [self.view viewWithTag:101];
        UITextField *textField1 = [self.view viewWithTag:102];
        UITextField *textField2 = [self.view viewWithTag:103];
        UITextField *textField3 = [self.view viewWithTag:104];
        
        if (textField1.text.length == 0){
            NSLog(@"交易金额不为空");
            [MBProgressHUD showError:@"请填写交易金额"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField2.text.length == 0){
            NSLog(@"费用类型不为空");
            [MBProgressHUD showError:@"请选择费用类型"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        if (textField3.text.length == 0) {
            NSLog(@"支付方式不为空");
            [MBProgressHUD showError:@"请选择支付方式"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        NSLog(@"发起申请");
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        NSString *key = textField2.text;
        NSString *key2 = textField3.text;
        NSString *charge_type = [self.charge_Type valueForKey:key];
        NSString *pay_type = [self.pay_Type valueForKey:key2];
        NSLog(@"cid = %@",[InfoSingleTon personInfoSingleTon].infoDic[@"cid"]);
        NSLog(@"glid = %@",self.caseDetailDic[@"id"]);
        NSDictionary *dic = @{
                        @"company_id":[InfoSingleTon personInfoSingleTon].infoDic[@"cid"],
//
                        @"glid":self.caseDetailDic[@"id"],
//
                        @"sfje":textField1.text,
                    
                        @"sflx":charge_type,
                    
                        @"bz":@"123456",
                        
                        @"fylx":pay_type,
                        
                        @"zt":@"1",
                        
                        @"audit_id":@"",
                        
                        @"audit_name":@"",
                        
                        @"create_id":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"id"],
                        
                        @"create_name":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"name"],
                        
                        @"create_time":@"2017-07-18",
                        
                        @"audit_time":textField.text,
                        
                        
                    };
        NSLog(@"dic = %@",dic);
        [NetworkingManager postUrl:ADDCHARGELIST_URL dic:dic Succeed:^(id responseData) {
            
            NSLog(@"addJobLog :%@",responseData);
            NSLog(@"%@",responseData);
            [MBProgressHUD showError:@"上传成功"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
            [MBProgressHUD showError:@"上传失败"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];

    }
    if (self.flag == 1) {
        UITextField *textField = [self.view viewWithTag:205];
        UITextField *textField1 = [self.view viewWithTag:206];
        UITextField *textField2 = [self.view viewWithTag:207];
        UITextView *textView = [self.view viewWithTag:600];
        
        if (textField.text.length == 0) {
            NSLog(@"日志类型不为空 ");
            [MBProgressHUD showError:@"请选择日志类型"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        if (textField1.text.length == 0){
            NSLog(@"开始时间不为空");
            [MBProgressHUD showError:@"请填写开始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField2.text.length == 0){
            NSLog(@"结束时间不为空");
            [MBProgressHUD showError:@"请填写结束时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if ([self compareDate:textField1.text withDate:textField2.text] == -1) {
            NSLog(@"结束时间小于开始时间");
            [MBProgressHUD showError:@"还没开始就截止咯"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if ([textView.text isEqualToString:@"请填写备注"]) {
            NSLog(@"备注说明不能为空 ");
            [MBProgressHUD showError:@"请填写备注说明"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        NSLog(@"发起申请");
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        NSString *key = textField.text;
        NSString *log_type = [self.log_Type valueForKey:key];
        NSDictionary *dic = @{
                              @"logname":@"",
                              
                              @"log_type":log_type,
                              
                              @"glid":self.caseDetailDic[@"id"],
                              
                              @"company_id":[InfoSingleTon personInfoSingleTon].infoDic[@"cid"],
                              
                              @"bzsm":@"123456",
                              
                              @"start_date":textField1.text,
                              
                              @"stop_date":textField2.text,
                              
                              @"create_id":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"id"],
                              
                              @"create_date":@"2017-07-18",
                              
                              @"update_date":@"2017-07-18",
                    };
        [NetworkingManager postUrl:ADDJOBLOGLIST_URL dic:dic Succeed:^(id responseData) {
            NSLog(@"%@",responseData);
            [MBProgressHUD showError:@"上传成功"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
            [MBProgressHUD showError:@"上传失败"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];
    }
    if (self.flag == 2) {
        UITextField *textField = [self.view viewWithTag:305];
        UITextField *textField1 = [self.view viewWithTag:306];
        UITextField *textField2 = [self.view viewWithTag:307];
        UITextField *textField3 = [self.view viewWithTag:308];
        UITextField *textField4 = [self.view viewWithTag:309];
        UITextField *textField5 = [self.view viewWithTag:310];
        UITextField *textField6 = [self.view viewWithTag:311];
        UITextField *textField7 = [self.view viewWithTag:312];
        UITextField *textField8 = [self.view viewWithTag:3120];
        UITextField *textField9 = [self.view viewWithTag:313];
        UITextField *textField10 = [self.view viewWithTag:3130];
        UITextField *textField11 = [self.view viewWithTag:314];
        UITextField *textField12 = [self.view viewWithTag:3140];
        
        if (textField.text.length == 0) {
            NSLog(@"办公机关不为空 ");
            [MBProgressHUD showError:@"请输入办案机关"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        if (textField1.text.length == 0){
            NSLog(@"侦查案号不为空");
            [MBProgressHUD showError:@"请填写侦查案号"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField2.text.length == 0) {
            NSLog(@"部门不为空 ");
            [MBProgressHUD showError:@"请填写部门"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
    
        if (textField3.text.length == 0) {
            NSLog(@"承办人不为空 ");
            [MBProgressHUD showError:@"请填写承办人"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField4.text.length > 0 && ![PhoneNumberFormat validateCellPhoneNumber:textField4.text]){
            NSLog(@"请检查电话号码格式");
            [MBProgressHUD showError:@"请检查电话号码格式"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField5.text.length == 0){
            NSLog(@"刑拘时间不为空");
            [MBProgressHUD showError:@"请填写刑拘时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }if (textField6.text.length == 0){
            NSLog(@"逮捕时间不为空");
            [MBProgressHUD showError:@"请填写逮捕时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }if (textField7.text.length == 0){
            NSLog(@"侦查起始时间不为空");
            [MBProgressHUD showError:@"请填写侦查起始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }if (textField8.text.length == 0){
            NSLog(@"侦查时间不为空");
            [MBProgressHUD showError:@"请填写侦查截止时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        NSLog(@"dateCompare:%zd",[self compareDate:textField7.text withDate:textField8.text]);
        if ([self compareDate:textField7.text withDate:textField8.text] == -1) {
            NSLog(@"结束时间小于开始时间");
            [MBProgressHUD showError:@"侦查还没开始就截止咯"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField9.text.length == 0){
            textField9.text = nil;
            NSLog(@"补充侦查时间不为空");
            [MBProgressHUD showError:@"请填写补充侦查起始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField10.text.length == 0){
            NSLog(@"侦查时间不为空");
            [MBProgressHUD showError:@"请填写补充侦查截止时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if ([self compareDate:textField9.text withDate:textField10.text] == -1) {
            NSLog(@"结束时间小于开始时间");
            [MBProgressHUD showError:@"补充侦查还没开始就截止咯"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField11.text.length == 0){
            NSLog(@"二次补充时间不为空");
            [MBProgressHUD showError:@"请填写二次补充起始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }if (textField12.text.length == 0){
            NSLog(@"侦查时间不为空");
            [MBProgressHUD showError:@"请填写二次补充截止时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if ([self compareDate:textField11.text withDate:textField12.text] == -1) {
            NSLog(@"结束时间小于开始时间");
            [MBProgressHUD showError:@"二次补充还没开始就截止咯"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        
        NSLog(@"发起申请");
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        NSDictionary *dic = @{
                              @"ooi_name":@"dasda",
                              
                              @"bajg":textField.text,
                              
                              @"zcah":textField1.text,
                              
                              @"bm":textField2.text,
                              
                              @"cbr":textField3.text,
                              
                              @"tel":textField4.text,
                              
                              @"xjsj":textField5.text,
                              
                              @"dbsj":textField6.text,
                              
                              @"company_id":[InfoSingleTon personInfoSingleTon].infoDic[@"cid"],
                              
                              @"zcqx_star":textField7.text,
                              
                              @"zcqx_end":textField8.text,
                              
                              @"bczcqx_star":textField9.text,
                              
                              @"bczcqx_end":textField10.text,
                              
                              @"ecbczc_star":textField11.text,
                              
                              @"ecbczc_end":textField12.text,
                              
                              @"bzsm":@"123456",
                              
                              @"glid":self.caseDetailDic[@"id"],
                              
                              @"create_id":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"id"],
                              
                              @"create_date":@"2017-07-18",
                              
                              @"update_date":@"2017-07-18", 
                    };
        NSLog(@"dic = %@",dic);
        [NetworkingManager postUrl:ADDINVESIGATION_URL dic:dic Succeed:^(id responseData) {NSLog(@"addJobLog :%@",responseData);
            NSLog(@"%@",responseData);
            [MBProgressHUD showError:@"上传成功"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
            [MBProgressHUD showError:@"上传失败"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];

    }
    if (self.flag == 3) {
        UITextField *textField = [self.view viewWithTag:404];
        UITextField *textField1 = [self.view viewWithTag:405];
        UITextField *textField2 = [self.view viewWithTag:406];
        UITextField *textField3 = [self.view viewWithTag:407];
        UITextField *textField4 = [self.view viewWithTag:408];
        UITextField *textField5 = [self.view viewWithTag:409];
        UITextField *textField6 = [self.view viewWithTag:4090];
        //        UITextView *textView = [self.view viewWithTag:600];
        //        if (textView.tag == 600 && [textView.text isEqualToString:@"请填写备注"]) {
        //            NSLog(@"备注说明不能为空 ");
        //            return;
        //        }
        if (textField.text.length == 0) {
            NSLog(@"办案地点不为空 ");
            [MBProgressHUD showError:@"请填写办案地点"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        if (textField2.text.length == 0){
            NSLog(@"部门不为空");
            [MBProgressHUD showError:@"请填写部门"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField3.text.length == 0){
            NSLog(@"承办人不为空");
            [MBProgressHUD showError:@"请填写承办人"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField4.text.length > 0 && ![PhoneNumberFormat validateCellPhoneNumber:textField4.text]){
            NSLog(@"请检查电话号码格式");
            [MBProgressHUD showError:@"请检查电话号码格式"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField5.text.length == 0){
            NSLog(@"审查起诉起始时间不为空");
            [MBProgressHUD showError:@"请填写审查起诉起始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField6.text.length == 0){
            NSLog(@"审查起诉截止时间不为空");
            [MBProgressHUD showError:@"请填写审查截止起始时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if ([self compareDate:textField5.text withDate:textField6.text] == -1) {
            NSLog(@"结束时间小于开始时间");
            [MBProgressHUD showError:@"审查还没开始就截止咯"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        NSLog(@"发起申请");
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        NSDictionary *dic = @{
                              @"badd":textField.text,
                              
                              @"bajg":textField1.text,
                              
                              @"bm":textField2.text,
                              
                              @"cbr":textField3.text,
                              
                              @"tel":textField4.text,
                              
                              @"iapaname":@"",
                              
                              @"scqs_star":textField5.text,
                              
                              @"scqs_end":textField6.text,
                              
                              @"glid":self.caseDetailDic[@"id"],
                              
                              @"company_id":[InfoSingleTon personInfoSingleTon].infoDic[@"cid"],
                              
                              @"bzsm":@"123456",
                              
                              @"create_id":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"id"],
                              
                              @"create_date":@"2017-07-18",
                              
                              @"update_date":@"2017-07-18",
                              
                    };
        [NetworkingManager postUrl:ADDPROCURATORATE_URL dic:dic Succeed:^(id responseData) {
            NSLog(@"%@",responseData);
            [MBProgressHUD showError:@"上传成功"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
            [MBProgressHUD showError:@"上传失败"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];

    }
    if (self.flag == 4) {
        UITextField *textField = [self.view viewWithTag:505];
        UITextField *textField1 = [self.view viewWithTag:506];
        UITextField *textField2 = [self.view viewWithTag:507];
        UITextField *textField3 = [self.view viewWithTag:508];
        UITextField *textField4 = [self.view viewWithTag:509];
        UITextField *textField5 = [self.view viewWithTag:510];
        UITextField *textField6 = [self.view viewWithTag:511];
        UITextField *textField7 = [self.view viewWithTag:512];
        UITextField *textField8 = [self.view viewWithTag:513];
        UITextField *textField9 = [self.view viewWithTag:514];
        UITextField *textField10 = [self.view viewWithTag:515];
        //        UITextView *textView = [self.view viewWithTag:600];
        //        if (textView.tag == 600 && [textView.text isEqualToString:@"请填写备注"]) {
        //            NSLog(@"备注说明不能为空 ");
        //            return;
        //        }
        if (textField.text.length == 0) {
            NSLog(@"审判程序不为空 ");
            [MBProgressHUD showError:@"请填写审判程序"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        if (textField1.text.length == 0){
            NSLog(@"立案时间不为空");
            [MBProgressHUD showError:@"请填写立案时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField2.text.length == 0){
            NSLog(@"开庭时间不为空");
            [MBProgressHUD showError:@"请填写开庭时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField3.text.length == 0){
            NSLog(@"宣判时间不为空");
            [MBProgressHUD showError:@"请填写宣判时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField4.text.length == 0){
            NSLog(@"上诉时间不为空");
            [MBProgressHUD showError:@"请填写上诉时间"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField6.text.length == 0){
            NSLog(@"法庭不为空");
            [MBProgressHUD showError:@"请填写法庭"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField7.text.length == 0){
            NSLog(@"主审法官不为空");
            [MBProgressHUD showError:@"请填写主审法官"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        if (textField8.text.length > 0 && ![PhoneNumberFormat validateCellPhoneNumber:textField8.text]){
            NSLog(@"请检查主审法官电话号码格式");
            [MBProgressHUD showError:@"请检查主审法官电话号码格式"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }if (textField10.text.length > 0 && ![PhoneNumberFormat validateCellPhoneNumber:textField10.text]){
            NSLog(@"请检查书记员电话号码格式");
            [MBProgressHUD showError:@"请检查书记员电话号码格式"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            return;
        }
        
        NSLog(@"发起申请");
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        NSDictionary *dic = @{
                              

                              @"fyktname":@"",
                              
                              @"spcx":textField.text,
                              
                              @"spjg":textField5.text,
                              
                              @"ladate":textField1.text,
                              
                              @"ktdate":textField2.text,
                              
                              @"spdate":textField3.text,
                              
                              @"ssdate":textField4.text,
                              
                              @"ft":textField6.text,
                              
                              @"zsfg":textField7.text,
                              
                              @"zsfgtel":textField8.text,
                              
                              @"sjy":textField9.text,
                              
                              @"sjytel":textField10.text,
                              
                              @"bzsm2":@"123456",
                              
                              @"glid":self.caseDetailDic[@"id"],
                              
                              @"company_id":[InfoSingleTon personInfoSingleTon].infoDic[@"cid"],
                              
                              @"zt":@"2",
                              
                              @"create_id":[InfoSingleTon personInfoSingleTon].infoDic[@"user"][@"id"],
                              
                              @"create_date":@"2017-07-18",
                              
                              @"update_date":@"2017-07-18",
                              
                              };
        
        NSLog(@"dic = %@",dic);
        [NetworkingManager postUrl:ADDCOURTINFO_URL dic:dic Succeed:^(id responseData) {
            
            NSLog(@"%@",responseData);
            [MBProgressHUD showError:@"上传成功"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
            [MBProgressHUD showError:@"上传失败"];
            [MBProgressHUD hideHUDForView:self.view animated:YES];
        }];

    }
}


//- (void)action_ClickButton:(UIButton *)sender{
//
//    NSLog(@"tag = %ld",sender.tag);
//}
- (void)textFieldsDidClick:(UIButton *)sender{
    //    if (self.flag == 0) {
    NSLog(@"tag = %ld",sender.tag);
    if (sender.tag == 101) {
        self.seletTag = 101;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 103) {
        self.seletTag = 103;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.selectLb.text = @"请选择";
        picker.customArr = @[@"预收款",@"追加费用",@"尾款",@"退款"];
        [self.view addSubview:picker];
    }
    if (sender.tag == 104) {
        self.seletTag = 104;
        JHPickView *picker = [[JHPickView alloc] initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.selectLb.text = @"请选择";
        picker.customArr = @[@"现金",@"刷卡"];
        [self.view addSubview:picker];
    }
    
    if (sender.tag == 205) {
        self.seletTag = 205;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.selectLb.text = @"请选择";
        picker.customArr = @[@"客户拜访",@"商务谈判",@"法律咨询",@"案例/资料检索",@"法律文书起草/修改",@"调查取证",@"案件研讨",@"刑案律师会见",@"诉讼/仲裁出庭",@"信访/社区/法援律师值班"];
        [self.view addSubview:picker];
    }
    if (sender.tag == 206) {
        self.seletTag = 206;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 207) {
        self.seletTag = 207;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 310) {
        self.seletTag = 310;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 311) {
        self.seletTag = 311;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 312) {
        self.seletTag = 312;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 3120) {
        self.seletTag = 3120;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 313) {
        self.seletTag = 313;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 3130) {
        self.seletTag = 3130;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 314) {
        self.seletTag = 314;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 3140) {
        self.seletTag = 3140;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 409) {
        self.seletTag = 409;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 4090) {
        self.seletTag = 4090;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 506) {
        self.seletTag = 506;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 507) {
        self.seletTag = 507;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 508) {
        self.seletTag = 508;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    if (sender.tag == 509) {
        self.seletTag = 509;
        JHPickView *picker = [[JHPickView alloc]initWithFrame:self.view.bounds];
        picker.delegate = self ;
        picker.arrayType = DeteArray;
        [self.view addSubview:picker];
    }
    
    
}

#pragma mark - UITextViewDelegate
- (void)textViewDidEndEditing:(UITextView *)textView
{
    if(textView.text.length < 1){
        textView.text = @"请填写备注";
        textView.textColor = [UIColor lightGrayColor];
    }
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
    if([textView.text isEqualToString:@"请填写备注"]){
        textView.text=@"";
        textView.textColor=[UIColor blackColor];
    }
}
#pragma mark - UITextFiledDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    
    /*
     *  判断输入是否为小数
     */
    //     判断是否有小数点
    NSLog(@"tex = %@  ns = %@  让 = %ld",textField.text,string,range.location);
    if ([textField.text containsString:@"."])
    {
        isHaveDian = YES;
    }else{
        isHaveDian = NO;
        
    } if (string.length > 0) {
        //当前输入的字符
        unichar single = [string characterAtIndex:0];
        NSLog(@"single = %c",single);
        
        // 不能输入.0-9以外的字符
        if (!((single >= '0' && single <= '9') || single == '.')) {
            [self showMyMessage:@"您的输入格式不正确" ];
            return NO;
        }
        
        // 只能有一个小数点
        if (isHaveDian && single == '.') {
            [self showMyMessage:@"最多只能输入一个小数点" ];
            return NO;
        }
        // 如果第一位是.则前面加上0.
        if ((textField.text.length == 0) && (single == '.')) {
            
            textField.text = @"0";
        }
        
        // 如果第一位是0则后面必须输入点，否则不能输入。
        if ([textField.text hasPrefix:@"0"]) {
            
            NSLog(@"tex = %@  ns = %@",textField.text,string);
            //            textField.text = @".";
            if (textField.text.length > 1) {
                NSString *secondStr = [textField.text substringWithRange:NSMakeRange(1, 1)];
                if (![secondStr isEqualToString:@"."]) {
                    [self showMyMessage:@"第二个字符需要是小数点" ];
                    return NO;
                }
            }else{
                if (![string isEqualToString:@"."]) {
                    [self showMyMessage:@"第二个字符需要是小数点" ];
                    return NO;
                }
            }
        }
        // 小数点后最多能输入两位
        if (isHaveDian) {
            NSRange ran = [textField.text rangeOfString:@"."];
            // 由于range.location是NSUInteger类型的，所以这里不能通过(range.location - ran.location)>2来判断
            if (range.location > ran.location) {
                if ([textField.text pathExtension].length > 1) {
                    [self showMyMessage:@"小数点后最多有两位小数" ];
                    return NO;
                }
            }
        }
    }
    
    return YES;
}

-(void)showMyMessage:(NSString*)aInfo {
    
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:aInfo delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
    
    [alertView show];
    
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    
    if (textField.tag == 101 || textField.tag == 103 || textField.tag == 104 || textField.tag == 205 || textField.tag == 206 || textField.tag == 207 || textField.tag == 304 || textField.tag == 310 || textField.tag == 311 || textField.tag == 312 || textField.tag == 3120 || textField.tag == 313 || textField.tag == 3130 || textField.tag == 314 || textField.tag == 3140 || textField.tag == 409 || textField.tag == 4090 || textField.tag == 506 || textField.tag == 507 || textField.tag == 508 ||  textField.tag == 509) {
        return NO;
    }
    else{
        return YES;
    }
    
}

#pragma mark - JHPickerViewDelegate
-(void)PickerSelectorIndixString:(NSString *)str
{
    self.selectStr = str ;
    NSLog(@"str = %@",self.selectStr);
    UITextField *textfield = [self.view viewWithTag:self.seletTag];
    textfield.text = str;
}
#pragma mark - Getter
- (NSDictionary *)log_Type{
    if (!_log_Type) {
        _log_Type = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"客户拜访",@"2",@"商务谈判",@"3",@"法律咨询",@"4",@"案例/资料检索",@"5",@"法律文书起草/修改",@"6",@"调查取证",@"7",@"案件研讨",@"8",@"刑案律师会见",@"9",@"诉讼/仲裁出庭",@"10",@"信访/社区/法援律师值班", nil];
    }
    return _log_Type;
}
- (NSDictionary *)charge_Type{
    if (!_charge_Type) {
        _charge_Type = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"预收款",@"2",@"追加费用",@"3",@"尾款",@"4",@"退款", nil];
    }
    return _charge_Type;
}
- (NSDictionary *)pay_Type{
    if (!_pay_Type) {
        _pay_Type = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"现金",@"2",@"刷卡", nil];
    }
    return _pay_Type;
}
- (NSArray *)titleArray{
    if (!_titleArray) {
        if (self.flag == 0) {
            _titleArray = [NSArray arrayWithObjects:@"收 款 案 件  ：",@"收 款 日 期  ：",@"交 易 金 额  ：",@"费 用 类 型  ：",@"支 付 方 式  ：",@"备 注 说 明  ：",nil];
            
        }
        else if (self.flag == 1){
            _titleArray = [NSArray arrayWithObjects:@"相 关 案 件  ：",@"案        号  ：",@"委托人  ：",@"当事人  ：",@"对方当事人  ：",@"日志类型  ：",@"开始时间  ：",@"结束时间  ：",@"备 注 说 明  ：",nil];
        }
        else if (self.flag == 2){
            _titleArray = [NSArray arrayWithObjects:@"相 关 案 件  ：",@"案        号  ：",@"委托人  ：",@"当事人：",@"对方当事人  ：",@"办案机关  ：",@"侦查案号  ：",@"部门  ：",@"承办人  ：",@"联系电话  ：",@"刑拘时间  ：",@"逮捕时间  ：",@"侦查时间  ：",@"补充侦查  ：",@"二次补充  ：",@"备 注 说 明  ：",nil];
        }
        else if (self.flag == 3){
            _titleArray = [NSArray arrayWithObjects:@"相 关 案 件  ：",@"案        号  ：",@"委托人  ：",@"当事人  ：",@"对方当事人  ：",@"办案机关  ：",@"部门  ：",@"承办人  ：",@"联系电话  ：",@"审查起诉  ：",@"备 注 说 明  ：",nil];
        }
        else if (self.flag == 4){
            _titleArray = [NSArray arrayWithObjects:@"相 关 案 件  ：",@"案        号  ：",@"委托人  ：",@"当事人  ：",@"对方当事人：",@"审判程序  ：",@"立案日期  ：",@"开庭日期  ：",@"宣判日期  ：",@"上诉日期  ：",@"审判机关  ：",@"法庭  ：",@"主审法官  ：",@"法官电话  ：",@"书记员  ：",@"书记员电话  ：",@"备 注 说 明  ：",nil];
        }
        
        
    }
    return _titleArray;
}
- (NSArray *)imageArray{
    if (!_imageArray) {
        if (self.flag == 0) {
            _imageArray = [NSArray arrayWithObjects:@"llist_01",@"llist_02",@"llist_03",@"llist_0",@"llist_05",@"llist_05",nil];
        }
        else if (self.flag == 1) {
            _imageArray = [NSArray arrayWithObjects:@"llist_01",@"llist_02",@"llist_03",@"llist_0",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",nil];
        }
        else if (self.flag == 2) {
            _imageArray = [NSArray arrayWithObjects:@"llist_01",@"llist_02",@"llist_03",@"llist_0",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",nil];
        }
        else if (self.flag == 3) {
            _imageArray = [NSArray arrayWithObjects:@"llist_01",@"llist_02",@"llist_03",@"llist_0",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",nil];
        }
        else if (self.flag == 4) {
            _imageArray = [NSArray arrayWithObjects:@"llist_01",@"llist_02",@"llist_03",@"llist_0",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",@"llist_05",nil];
        }
        
    }
    return _imageArray;
}
- (NSArray *)placeHolderArray{
    if (!_placeHolderArray) {
        if (self.flag == 0) {
            _placeHolderArray = [NSArray arrayWithObjects:@"请点撒",@"请选择收款日期",@"请输入金额（只能填写数字或者“.”）",@"请选择",@"请选择",@"请选择",nil];
        }
        else if (self.flag == 1) {
            _placeHolderArray = [NSArray arrayWithObjects:@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请选择",@"请选择开始时间",@"请选择结束时间",@"请填写备注",nil];
        }
        else if (self.flag == 2) {
            _placeHolderArray = [NSArray arrayWithObjects:@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请输入办案机关",@"请填写侦查案号",@"请填写部门",@"请填写承办人",@"请填写联系电话",@"请选择刑拘时间",@"请选择逮捕时间",@"起始时间",@"起始时间",@"起始时间",@"请选择",nil];
        }
        else if (self.flag == 3) {
            _placeHolderArray = [NSArray arrayWithObjects:@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请填写办案机关",@"请填写部门",@"请填写承办人",@"请填写联系电话",@"起始时间",@"请选择",nil];
        }
        else if (self.flag == 4) {
            _placeHolderArray = [NSArray arrayWithObjects:@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请点撒",@"请填写审批程序",@"请选择立案日期",@"请选择开庭时间",@"请选择宣判日期",@"请选择上诉日期",@"请填写审批机关",@"请填写法庭",@"请填写主审法官",@"请填写法官电话",@"请填写书记员",@"请填写书记员电话",@"请选择",nil];
        }
        
    }
    return _placeHolderArray;
}
- (NSArray *)starArray{
    if (!_starArray) {
        if (self.flag == 0) {
            _starArray = [NSArray arrayWithObjects:@"",@"",@"*",@"*",@"*",@"",nil];
        }
        else if (self.flag == 1) {
            _starArray = [NSArray arrayWithObjects:@"",@"",@"",@"",@"",@"*",@"*",@"*",@"",nil];
        }
        else if (self.flag == 2) {
            _starArray = [NSArray arrayWithObjects:@"",@"",@"",@"",@"",@"*",@"*",@"*",@"*",@"",@"*",@"*",@"*",@"*",@"*",@"",nil];
        }
        else if (self.flag == 3) {
            _starArray = [NSArray arrayWithObjects:@"",@"",@"",@"",@"*",@"",@"*",@"*",@"",@"*",@"",nil];
        }
        else if (self.flag == 4) {
            _starArray = [NSArray arrayWithObjects:@"",@"",@"",@"",@"",@"*",@"*",@"*",@"*",@"*",@"",@"*",@"*",@"",@"",@"",@"",nil];
        }
        
    }
    return _starArray;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
